package top.zackyoung.bbs.utils;

import org.apache.commons.io.FilenameUtils;

import java.util.UUID;

/**
 * @author: ZackYoung
 * @time: 2020/6/9
 */

public class FileUtil {
    /**
     * 获取文件后缀名
     * @param path
     */
    public static String getExtension(String path){
        if(path != null && !"".equals(path.trim())){
            String extension = FilenameUtils.getExtension(path);
            if(extension != null && !"".equals(extension.trim())){//后缀名改为小写
                extension = extension.toLowerCase();
            }
            return extension;
        }
        return "";

    }
    /**
     * 修改文件名
     */
    public static String renameImg(){
        String uuid = UUID.randomUUID().toString().replace("-","");
        return uuid;
    }
}
